import request from '../utils/request'

// 相关API
export const appApi = {
  // 开始
  taskStart(data) {
    return request({
      url: '/ztzwai/task_start',
      method: 'post',
      data
    })
  },
  
  // 结束
  taskStop(data) {
    return request({
      url: '/ztzwai/task_stop',
      method: 'post',
      data
    })
  },  
  // 获取用户列表
  getUserList(params) {
    return request({
      url: '/user/list',
      method: 'get',
      params
    })
  }
}

// 通用API方法
export const commonApi = {
  // GET请求
  get(url, params = {}) {
    return request({
      url,
      method: 'get',
      params
    })
  },
  
  // POST请求
  post(url, data = {}) {
    return request({
      url,
      method: 'post',
      data
    })
  },
  
  // PUT请求
  put(url, data = {}) {
    return request({
      url,
      method: 'put',
      data
    })
  },
  
  // DELETE请求
  delete(url, params = {}) {
    return request({
      url,
      method: 'delete',
      params
    })
  }
}

// 导出默认的request实例
export { default as request } from '../utils/request'